<include file="Public:header"/>
<script type="text/javascript" src="__WEBPUBLIC__/Admin/js/ajax-operate.js"></script>
<script type="text/javascript" src="__WEBPUBLIC__/Admin/laydate/laydate.js"></script>
<!--主页面-->
<div id="main-content" class="content">
    <ul class="breadcrumb">
        <li><a href="{:U('Index/main')}">首页</a></li>
        <li class="active"><a href="">相册管理</a></li>
        <li class="active">相册列表</li>
    </ul>

    <div class="page-header page-header1 clearfix">
        <h3>相册管理</h3>
        <ul class="nav nav-tabs">
            <li class="active">
                <a href="{:U('Picture/pictureList')}">相册列表</a>
            </li>
            <li class="">
                <a href="{:U('Picture/addPicture')}">添加相册</a>
            </li>
        </ul>
    </div>
    <div class="search-content">
        <form action="{:U('Picture/pictureList')}" method="post" class="search-form form-inline" role="form">
            <input placeholder="请输入开始日期" name="start_time" value="{$start_time}" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" style="width: 180px;height:34px;border-radius:5px">&nbsp;&nbsp;
            <input placeholder="请输入结束日期" name="end_time" value="{$end_time}" class="laydate-icon" onclick="laydate({istime: true, format: 'YYYY-MM-DD hh:mm:ss'})" style="width: 180px;height:34px;border-radius:5px">
            <style>
                #laydate_ys{
                    overflow: hidden;!important;
                }
                .laydate_body .laydate_bottom{
                    height: 40px;!important;
                }
            </style>
            <button type="submit" class="btn derive">查询</button>
        </form>
    </div>
    <div class="content-box-table content-box-content">
        <form action="{:U('Picture/delPicture')}" method="post" class="batch-form">
            <table class="table table-striped table-framed table-hover">
                <thead>
                <tr>
                    <th width="8%">
                        <input class="check-all" type="checkbox" />&nbsp;&nbsp;编号
                    </th>
                    <th>显示顺序</th>
                    <th>图片</th>
                    <th>添加时间</th>
                    <th>操作</th>
                </tr>
                </thead>
                <tbody class="tbody">
                <if condition="empty($list)">
                    <tr style="text-align: center;font-size: 14px;"><td colspan="20">暂无数据</td></tr>
                </if>
                <volist name="list" id="vo">
                    <tr>
                        <td><input type="checkbox" value="{$vo['pic_id']}" name="pic_id[]"/>&nbsp;&nbsp;{$vo['pic_id']}</td>
                        <td><input type="number" class="form-control sort" name="sort" data-id="{$vo['pic_id']}" value="{$vo['sort']}"></td>
                        <td><if condition="$vo['pic'] neq ''">
                            <img src="/{$vo['pic']}" style="max-width: 150px;max-height: 120px;">
                            <else/>暂无图片
                        </if>
                        </td>
                        <td>{$vo['ctime']|date='Y-m-d H:i:s',###}</td>
                        <td>

                            <eq name="vo['status']" value="0">
                                <a title="显示" class="modify" style="cursor: pointer" onclick="up({$vo['pic_id']},1)">
                                    <span class="icon glyphicon glyphicon-arrow-up"></span>
                                </a>&nbsp;
                            </eq>
                            <eq name="vo['status']" value="1">
                                <a title="不显示" class="modify" style="cursor: pointer" onclick="up({$vo['pic_id']},0)">
                                    <span class="icon glyphicon glyphicon-arrow-down"></span>
                                </a>&nbsp;
                            </eq>
                            <a href="#" title="删除" class="delete-delete">
                                <span class="icon glyphicon glyphicon-remove"></span>
                            </a><input type="hidden" value="{:U('Picture/delPicture',array('pic_id'=>$vo['pic_id']))}">
                        </td>
                    </tr>
                </volist>
                </tbody>
                <tfoot>
                <tr>
                    <td colspan="20">
                        <div class="bulk-actions fl">
                            <input type="button" class="btn delete-batch" value="批量删除">　
                        </div>

                        <div class="fr">
                            {$page}
                        </div>

                    </td>
                </tr>
                </tfoot>
            </table>
        </form>
    </div>
</div>
<script>
    function up(id,status){
            var url = "{:U('Picture/ajaxStatus')}";
            $.post(url,{'id':id,'status':status},function(data){
                if(data.status==1){
                    alert("修改成功");
                    window.location.reload();
                }else{
                    alert("修改失败");
                }
            });
    }

    $('.sort').change(function(){
        var p_id = $(this).attr('data-id');
        var sort = $(this).val();
        $.post("{:U('Picture/ajaxSort')}",{pic_id:p_id,sort:sort},function(){},'json');
    });

</script>
<include file="Public:footer"/>

